package com.dragon.app.practice;

import java.util.Scanner;

public class MoneyChange {

	private static final char[] units = new char[] { '圆', '拾', '佰', '仟', '万', '拾', '佰', '仟', '亿', '拾', '佰', '仟', '亿',
			'拾', '佰', '仟', '亿' };
	private static final char[] cnNum = new char[] { '零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖' };

	
	/**
	 * 阿拉伯金额 转 中文金额
	 * @param money
	 * @return
	 */
	// 105600123 => 壹亿零仟伍佰陆拾零万零仟壹佰贰拾叁圆整
	public static String convert(long money) {
		StringBuffer cnMoney = new StringBuffer("整");
		for (int i = 0; money != 0; i++) {
			cnMoney.insert(0, units[i]);
			cnMoney.insert(0, cnNum[(int) (money % 10)]);
			money /= 10;
		}
		return cnMoney.toString();
	}

	
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			System.out.println("请输入数字金额：");
			long money = scanner.nextLong();
			System.out.println(convert(money));
		}
	}

}
